package la.iok.hzsvn.lewin.movie.shopmovie.model;

public class JoinPlayerResult {
    /**
     * 玩家id
     */
    private Long userId;
    /**
     * 添加的结果。1：成功添加，2：添加失败，用户无法加入拼车，3：用户可以加入但是已经在其他拼车中，需要操作者确认是否继续添加。
     */
    private Integer result;
    /**
     * result为2或者3时的提示信息
     */
    private String message;

    /**
     * 构造添加用户失败的结果
     * @param userId 用户id
     * @param message 失败的消息
     * @return 添加玩家结果
     */
    public static JoinPlayerResult failed(Long userId, String message){
        JoinPlayerResult result = new JoinPlayerResult();
        result.userId = userId;
        result.result = 2;
        result.message = message;
        return result;
    }

    /**
     * 构造成功添加用户的结果
     * @param userId 用户id
     * @return 添加玩家结果
     */
    public static JoinPlayerResult success(Long userId){
        JoinPlayerResult result = new JoinPlayerResult();
        result.result = 1;
        result.userId = userId;
        return result;
    }

    /**
     * 构造需要确认的添加用户结果
     * @param userId 用户id
     * @param message 确认的提示信息
     * @return 添加玩家结果
     */
    public static JoinPlayerResult confirm(Long userId, String message){
        JoinPlayerResult result = new JoinPlayerResult();
        result.result = 3;
        result.userId = userId;
        result.message = message;
        return result;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Integer getResult() {
        return result;
    }

    public void setResult(Integer result) {
        this.result = result;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
